/*
* @Author: Marte
* @Date:   2017-05-15 23:40:55
* @Last Modified by:   Marte
* @Last Modified time: 2017-05-17 00:53:46
*/

'use strict';

{
var swiper = new Swiper('.swiper-container', {
    scrollbar: '.swiper-scrollbar',
    scrollbarHide: true,
    slidesPerView: 'auto',
    spaceBetween: 30,
    nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev',
    grabCursor: true
});
}
{
var myChart = echarts.init(document.getElementById('mainbg'));
myChart.showLoading({
    maskColor: 'rgb(28, 34, 67)',
    textColor: '#fff'
});
$.get('js/movie.json', function (webkitDep) {
    myChart.hideLoading();

var option4 = {
    backgroundColor: '#1c2243',
    legend: {
        data: ['动作', '爱情', '科幻', '喜剧', '恐怖', '冒险', '惊悚', '动画'],
        textStyle: {
            color: '#fff'
        }
    },
    series: [{
        type: 'graph',
        roam: true,
        layout: 'force',
        hoverAnimation: true,
        animation: true,
        label: {
            normal: {
                position: 'right',
                formatter: '{b}',
                show: true
            }
        },
        draggable: true,
        data: webkitDep.nodes.map(function (node, idx) {
            node.id = idx;
            return node;
        }),
        categories: webkitDep.categories,
        force: {
            // initLayout: 'circular',
            // repulsion: 20,
            edgeLength: 210,
            repulsion: 20,
            gravity: 0.01
        },
        focusNodeAdjacency: true,
        symbolSize: 30,
        edges: webkitDep.links
    }]
};

    myChart.setOption(option4);
});


}